<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">

	<ui:define name="body">

		<h:form id="colorSearch" styleClass="edit">

			<rich:simpleTogglePanel label="Filtros de Busqueda" switchType="ajax">

				<s:decorate template="layout/display.xhtml">
					<ui:define name="label">Codigo</ui:define>
					<h:inputText id="nombre"
						value="#{colorList.color.codigoColor}" size="4" />
				</s:decorate>

				<s:decorate template="layout/display.xhtml">
					<ui:define name="label">Nombre</ui:define>
					<h:inputText id="nombre" value="#{colorList.color.nombre}"
						size="60" />
				</s:decorate>

			</rich:simpleTogglePanel>

			<div class="actionButtons"><h:commandButton id="search"
				value="Buscar" action="/ColorList.xhtml" /> <s:button
				id="reset" value="Limpiar Busqueda" includePageParams="false" /></div>

		</h:form>

		<rich:panel>
			<f:facet name="header">Resultados</f:facet>
			<div class="results" id="colorList"><h:outputText
				value="No hay colores que coincidan con la busqueda"
				rendered="#{empty colorList.resultList}" /> <rich:dataTable
				id="colorList" var="_color"
				onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
				onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
				value="#{colorList.resultList}"
				rendered="#{not empty colorList.resultList}">
				
				<h:column>
					<f:facet name="header">
						<ui:include src="layout/sort.xhtml">
							<ui:param name="entityList" value="#{colorList}" />
							<ui:param name="propertyLabel" value="Codigo del color" />
							<ui:param name="propertyPath" value="color.codigoColor" />
						</ui:include>
					</f:facet>
					<h:outputText value="#{_color.codigoColor}" />
				</h:column>
				<h:column>
					<f:facet name="header">
						<ui:include src="layout/sort.xhtml">
							<ui:param name="entityList" value="#{colorList}" />
							<ui:param name="propertyLabel" value="Nombre" />
							<ui:param name="propertyPath" value="color.nombre" />
						</ui:include>
					</f:facet>
					<h:outputText value="#{_color.nombre}" />
				</h:column>
				<rich:column styleClass="action">
					<f:facet name="header">Accion</f:facet>
					<s:link view="/#{empty from ? 'Color' : from}.xhtml"
						value="#{empty from ? '' : 'Seleccionar'}"
						propagation="#{empty from ? 'none' : 'default'}"
						id="colorViewId">
						<f:param name="colorIdColor"
							value="#{_color.idColor}" />
					</s:link>
            #{' '}
            <s:link view="/ColorEdit.xhtml" value="Editar"
						propagation="none" id="colorEdit" rendered="#{empty from}">
						<f:param name="colorIdColor"
							value="#{_color.idColor}" />
					</s:link>
				</rich:column>
			</rich:dataTable></div>
			<div class="tableControl"><s:link view="/ColorList.xhtml"
				rendered="#{colorList.previousExists}"
				value="#{messages.left}#{messages.left} Primera Pagina" id="firstPage">
				<f:param name="firstResult" value="0" />
			</s:link> <s:link view="/ColorList.xhtml"
				rendered="#{colorList.previousExists}"
				value="#{messages.left} Pagina Anterior" id="previousPage">
				<f:param name="firstResult"
					value="#{colorList.previousFirstResult}" />
			</s:link> <s:link view="/ColorList.xhtml"
				rendered="#{colorList.nextExists}"
				value="Proxima Pagina #{messages.right}" id="nextPage">
				<f:param name="firstResult" value="#{colorList.nextFirstResult}" />
			</s:link> <s:link view="/ColorList.xhtml"
				rendered="#{colorList.nextExists}"
				value="Ultima Pagina #{messages.right}#{messages.right}" id="lastPage">
				<f:param name="firstResult" value="#{colorList.lastFirstResult}" />
			</s:link></div>
		</rich:panel>

		<s:div styleClass="actionButtons" rendered="#{empty from}">
			<s:button view="/ColorEdit.xhtml" id="create" propagation="none"
				value="Agregar Colores">
				<f:param name="colorIdColor" />
			</s:button>
		</s:div>

	</ui:define>

</ui:composition>
